﻿using Autofac;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Micro.Modules.Abstractions;
public abstract class BaseModule
{
    /// <summary>
    /// 
    /// </summary>
    public virtual int Order => 0;



    /// <summary>
    /// 将模块服务添加到依赖注入服务容器中
    /// </summary>
    /// <param name="services">依赖注入服务容器</param>
    /// <returns></returns>
    public virtual IServiceCollection AddModuleServices(IServiceCollection services, IModule module)
    {
        return services;
    }

    /// <summary>
    /// 配置中间件
    /// </summary>
    /// <param name="app">服务提供者</param>
    public virtual void Configure(IApplicationBuilder app, IModule module)
    {
    }


    /// <summary>
    /// Autofac
    /// </summary>
    /// <param name="builder"></param>
    public virtual void AutofacConfigureContainer(ContainerBuilder builder)
    {
    }
}
